/**
 * Copyright(c) 2014 Xunton Solutions
 *
 * History:
 *   15-12-8 上午10:39 Created by dwzhang
 */
package com.jade.modules.message.store;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;

/**
 * 简单的消息记录。一般用于消息中心的构建，保存用户发送的或者收到的各类消息。
 *
 * @author <a href="mailto:dwzhang@xunton.com">dwzhang</a> 
 * @version 1.0 15-12-8 上午10:39
 */
@Entity
@Table (name = "MODULE_MESSSAGE_RECORD")
public class MessageRecord
        implements Serializable
{
    public static final int STATUS_NEW = 0;
    public static final int STATUS_READ = 1;
    @Id
    @GeneratedValue (generator = "MODULE_SEQ_MESSSAGE_RECORD")
    @SequenceGenerator (name = "MODULE_SEQ_MESSSAGE_RECORD", sequenceName = "MODULE_SEQ_MESSSAGE_RECORD")
    private long id;
    //消息分类
    @Column (name = "category", length = 32, nullable = false, updatable = false)
    private String category;
    //消息类型
    @Column (name = "type", length = 32, nullable = false, updatable = false)
    private String type;
    //发送者类型
    @Column (name = "sender_type", length = 32, nullable = false, updatable = false)
    private String senderType;
    //发送者
    @Column (name = "sener", length = 64, nullable = false, updatable = false)
    private String sener;
    //接收者类型
    @Column (name = "receiver_type", length = 32, nullable = false, updatable = false)
    private String receiverType;
    //接收者
    @Column (name = "receiver", length = 64, nullable = false, updatable = false)
    private String receiver;
    //消息主题
    @Column (name = "subject", length = 64, updatable = false)
    private String subject;
    //消息内容
    @Lob
    @Column (name = "content", updatable = false)
    private String content;
    //消息链接
    @Column (name = "url", length = 128, updatable = false)
    private String url;
    //消息图片
    @Column (name = "image", length = 64, updatable = false)
    private String image;
    //消息关联的应用标识
    @Column (name = "fid", length = 64, updatable = false)
    private String fid;
    //消息扩展参数，根据type而定，采用json格式存储
    @Lob
    @Column (name = "params", updatable = false)
    private String params;
    //消息状态 0 - 未读  1 - 已读
    @Column (name = "status")
    private int status = STATUS_NEW;
    //消息创建时间
    @Column (name = "creation_date", nullable = false, updatable = false)
    private Date creationDate;

    public long getId()
    {
        return id;
    }

    public void setId(long id)
    {
        this.id = id;
    }

    public String getCategory()
    {
        return category;
    }

    public void setCategory(String category)
    {
        this.category = category;
    }

    public String getType()
    {
        return type;
    }

    public void setType(String type)
    {
        this.type = type;
    }

    public String getSenderType()
    {
        return senderType;
    }

    public void setSenderType(String senderType)
    {
        this.senderType = senderType;
    }

    public String getSener()
    {
        return sener;
    }

    public void setSener(String sener)
    {
        this.sener = sener;
    }

    public String getReceiverType()
    {
        return receiverType;
    }

    public void setReceiverType(String receiverType)
    {
        this.receiverType = receiverType;
    }

    public String getReceiver()
    {
        return receiver;
    }

    public void setReceiver(String receiver)
    {
        this.receiver = receiver;
    }

    public String getSubject()
    {
        return subject;
    }

    public void setSubject(String subject)
    {
        this.subject = subject;
    }

    public String getContent()
    {
        return content;
    }

    public void setContent(String content)
    {
        this.content = content;
    }

    public String getUrl()
    {
        return url;
    }

    public void setUrl(String url)
    {
        this.url = url;
    }

    public String getImage()
    {
        return image;
    }

    public void setImage(String image)
    {
        this.image = image;
    }

    public String getFid()
    {
        return fid;
    }

    public void setFid(String fid)
    {
        this.fid = fid;
    }

    public String getParams()
    {
        return params;
    }

    public void setParams(String params)
    {
        this.params = params;
    }

    public int getStatus()
    {
        return status;
    }

    public void setStatus(int status)
    {
        this.status = status;
    }

    public Date getCreationDate()
    {
        return creationDate;
    }

    public void setCreationDate(Date creationDate)
    {
        this.creationDate = creationDate;
    }
}
